<?php 

header("Content-type: text/html; charset=utf-8"); 



$sql = @mysql_connect("127.0.0.1",'root',"");

if (!$sql) {
	echo "连接失败";
	echo "<br>";
	echo "错误代码:".mysql_errno();
	echo "<br>";
	echo "错误信息：".mysql_error();
	exit();
}

echo "连接成功";

$res = mysql_select_db("stu") ;

if (!$res) {
	echo "连接失败2";
	echo "<br>";
	echo "错误代码:".mysql_errno();
	echo "<br>";
	echo "错误信息：".mysql_error();
	exit();
}

mysql_query("set names utf8");

$yuju = "select * from stu";

// $yuju = 'update stu set age="1" where id = "15"';

$yuju = "show tables";

$yuju = 'INSERT INTO stu (name,sex) VALUES ("笑笑","女")';

$yuju = "delete from stu where id>16";

$res = mysql_query($yuju);

if (!$res) {
	echo "连接失败3";
	echo "<br>";
	echo "错误代码:".mysql_errno();
	echo "<br>";
	echo "错误信息：".mysql_error();
	exit();
}

// $id = mysql_insert_id($sql);

// var_dump($id);

// var_dump($res);

// var_dump($res);

// $arr = [];

// while ( $row = mysql_fetch_assoc($res) ) {
// 	$arr[] = $row;
// }

// var_dump($arr);
// 
// var_dump(mysql_fetch_assoc($res));

// var_dump(mysql_fetch_assoc($res));

// var_dump(mysql_fetch_assoc($res));

// var_dump(mysql_fetch_assoc($res));

// var_dump(mysql_fetch_assoc($res));

// mysql_free_result($sql);
// mysql_close($sql);

 ?> 